<!--
 * @Description: 
 * @Version: 2.0
 * @Autor: wsh
 * @Date: 2024-01-31 16:01:08
 * @LastEditors: wsh
 * @LastEditTime: 2024-01-31 17:43:31
-->
<template>
  <el-timeline>
    <el-timeline-item :timestamp='item.createTime' placement="top" v-for="(item, index) in timerShaft" :key="index">
      <el-card>
        <div class="box">
          <h2>{{ item.content }}</h2>
          <el-tag class="ml-2" :type='veinStatusName(item).type'>{{ veinStatusName(item).label
          }}</el-tag>
        </div>
        <div class="boxTwo">
          <span v-show="item.veinStatus == 1" class="boxTwolabel">后台管理员:</span>
          <span>{{ item.labelsContent[0].label || '' }}</span>
        </div>
      </el-card>
    </el-timeline-item>
  </el-timeline>
</template>

<script setup lang="ts">
import apiMod from '@/apiMod/index'
type Props = {
  nowRowData?: any
}
let props = withDefaults(defineProps<Props>(), {
  nowRowData: {},
})
let timerShaft: any = ref([])
// let veinStatusName: any = (item: any) => {
//   switch (item.veinStatus) {
//     case 0:
//       return {
//         label: '未核验', type: 'warning'
//       }
//     case 1:
//       return {
//         label: '待复验', type: 'info'
//       }
//     case 2:
//       return {
//         label: '核验成功', type: 'success'
//       }
//     case 3:
//       return {
//         label: '核验失败', type: 'danger'
//       }
//     case 4:
//     default:
//       return {
//         label: '未知状态', type: 'danger'
//       }
//   }
// }
let veinStatusName: any = computed(() => {

  return (item: any) => {
    console.log(item, 'item');

    switch (item.veinStatus) {
      case 0:
        return {
          label: '未核验',
          type: 'warning'
        };
      case 1:
        return {
          label: '待复验',
          type: 'info'
        };
      case 2:
        return {
          label: '核验成功',
          type: 'success'
        };
      case 3:
        return {
          label: '核验失败',
          type: 'danger'
        };
      case 4:
      default:
        return {
          label: '未知状态',
          type: 'danger'
        };
    }
  };
});
const getTimeNode = () => {
  let params = {
    associationId: props.nowRowData.id,
    tableName: 'icc_vena_digitalis'//表名
  }
  apiMod.view_dpServiceTimeline_page(params).then(res => {
    console.log(res.data.records, 'res');
    timerShaft.value = res.data.records
  })
}
getTimeNode()
</script>

<style scoped lang="scss">
.box {
  width: 30%;
  display: flex;
  justify-content: space-between;
}

.boxTwo {
  margin-top: 10px;

  .boxTwolabel {
    margin-right: 10px;
  }
}
</style>